package com.shopping_back.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.shopping_back.pojo.entity.ComboItem;
import com.shopping_back.pojo.vo.SkuItemVO;
import com.shopping_back.pojo.vo.SkuVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ComboItemMapper extends BaseMapper<ComboItem> {
    @Select("SELECT s.id AS sku_id, s.spu_id, sp.title AS spu_title, s.specs_json, s.price, s.stock, s.sku_image, " +
            "NULL AS seckill_price, NULL AS seckill_stock, NULL AS limit_per_user, " +
            "NULL AS group_price, NULL AS required_count, NULL AS duration_minutes, " +
            "NULL AS threshold, NULL AS discount, c.combo_price " +
            "FROM combo_item ci " +
            "JOIN sku s ON ci.sku_id = s.id " +
            "JOIN spu sp ON s.spu_id = sp.id " +
            "JOIN combo c ON ci.combo_id = c.id " +
            "WHERE c.activity_id = #{activityId}")
    List<SkuItemVO> selectComboItems(Long activityId);
}
